<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<load href="__PUBLIC__/css/bootstrap.min.css" />
<load href="__PUBLIC__/css/main.css" />
<load href="__PUBLIC__/css/plate.css" />
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<load href="__PUBLIC__/js/main.js" />
<script type="text/javascript">
$(function(){
	var template = "{$result.template}";
	$("select[name='template'] option").each(function(index, element) {
		var t = $(this).val();
		if(t == template){
			if(t == 'index9' || t == 'index10'){
				$(".tmp_n").show();
			}else{
				$(".tmp_n").hide();
			}
			$(this).attr("selected","selected");
			$(".thumbpreview:eq("+(index)+")").show().siblings().hide();
		}
	});
	function select_plate(){
		$(".select_p").each(function(index, element) {
				var val = $(this).attr("vla");
				var platetype = $(this).attr("plate_type");
				if(platetype == 3){
					$("#tpl_iframe").contents().find(".zhengfu").show();
					var carousel_inner = $( "#tpl_iframe" ).contents().find(".carousel-inner");
					if($(this).is(".red")){
						var bannerimg = $(this).attr("bannerimg");
						carousel_inner.append("<div class=\"item active zf_"+val+"\"><img src=\""+bannerimg+"\" class=\"slide-image\"/></div>");
					}else{
						carousel_inner.find(".zf_"+val).remove();
					}
				}
				if($(this).is(".red")){
					$(this).addClass("red");
					$( "#tpl_iframe" ).contents().find(".p_"+val).show();
				}else{
					$(this).removeClass("red");
					$( "#tpl_iframe" ).contents().find(".p_"+val).hide();
				}
        });
	}
	function isbodyshow(){
		<if condition="$result.state eq 0">
			$("#tpl_iframe").contents().find(".body_close").show();
			$("#tpl_iframe").contents().find(".body").hide();
			<else/>
			$("#tpl_iframe").contents().find(".body_close").hide();
			$("#tpl_iframe").contents().find(".body").show();
		</if>
	}
	function isshowvshow(){
		<if condition="$result.showv eq 0">
			$("#tpl_iframe").contents().find(".showv").hide();
			<else/>
			$("#tpl_iframe").contents().find(".showv").show();
		</if>
	}

	function ep_fwei_tar(){
		var ep_fwei_value = $("input[name='ep_fwei']:checked").val();
		if(ep_fwei_value==1){
			$("#fweishow").show();
		}else{
			$("#fweishow").hide();
		}	
	}
	$("input[name='ep_fwei']").each(function(index, element) {
        $(this).click(function(){
			if($(this).val()==1){
				$("#fweishow").show();
			}else{
				$("#fweishow").hide();
			}
		})
    });
	window.onload = function(){
　　		ep_fwei_tar();
		select_plate();
		isbodyshow();
		isshowvshow();
		tmp_contrll();
	}

	function tmp_contrll(){
		var tmp =  $("select[name='template']");
		tmp.change(function(){
			var tmp_val = $(this).find("option:selected").val();
			if(tmp_val == 'index9' || tmp_val == 'index10'){
				$(".tmp_n").show();
			}else{
				$(".tmp_n").hide();
			}
		})
	}

})
</script>
</head>

<body>
<!-- 图片资源开始 -->
<div class="floatBackground" id="floatBackground" style="display: none;">
	<div class="bounced">
	<label class="closeImgResurces">X</label>
	<iframe id="imgResourcesiframe" src="{:rtrim(U('Upload/index'),'.html')}" width="750" height="465" frameborder="0" scrolling="auto"></iframe>
	</div>
</div>
<!-- 图片资源结束 -->
<!-- 模板页 -->
<div class="tpl_illustrate"><span>模板样式</span><iframe id="tpl_iframe" class="tpl_iframe" frameborder="0" scrolling="yes" src=""></iframe></div>
<assign name="tplrbac" value="$Think.session.userinfo.tplrbac"/>
<div class="main-frame">
	<div class="position">华人码 > 编辑华人码</div>
	<div class="addobject">
		<div class="obj-form">
			<form name="form1" id="typeform1" action="{:U('Type/typeedit',array('id'=>$result['id']))}" method="post" class="form-inline">
				<ul>
					<li>
						<label class="fl tle">码台标题：</label>
						<span class="fl cnt"><input name="typename" class="form-control" placeholder="标题" value="{$result.typename}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">模板选择：</label>
				    	<span class="fl cnt">
					    	<select name="template" class="template form-control" <if condition="$accounttype neq ''">disabled</if> style="width: 300px; padding: 0px 6px;">
								<volist name="tpl" id="v">
									<in name="v['key']" value="$tplrbac">
										<option <if condition="$v['idx'] eq $result['template']">selected="selected"</if> value="{$v['idx']}">{$v['name']}{$v['des']}</option>
									</in>
								</volist>
							</select>
							<em>*</em>
				    	</span>
					</li>
					<!--<li>
						<label class="fl tle">domainID：</label>
						<span class="fl cnt"><input name="domainid" class="form-control" placeholder="domainid" value="{$result.domainid}"><em>* <font>关联旧版的domainID</font></em></span>
					</li>-->
					<li class="tmp_n oline" style="width:100%;"><span class="dividerline"></span></li>
					<li class="tmp_n"><label class="fl tle" style="font-weight: bold; font-size: 16px; width: 600px;">选择模块（点击模块可在右侧预览效果）</label></li>
					<li class="tmp_n">
						<label class="fl tle">模块名称：</label>
						<span class="fl cnt" style="display:block; overflow:auto; min-height: 200px; max-height:500px; width:600px;">


<style type="text/css">
	span.plate_province{line-height: 36px; margin-top: 0px; font-size: 14px; font-weight: normal;}
	span.plate_province em{font-style:normal; display: block; clear: both; margin-left: 20px; font-weight: normal; color: #606060;}
	span.plate_province em.em10{margin-left: 45px;}
	span.plate_province em.em20{margin-left: 65px;}
	.obj-form li span.plate_province em{color: #606060;}
	.plate_outline{margin-top: 0px;}
	.plate_title{margin-bottom: 0px;}
	.plate_outline{padding-top: 0px;}
	.select_p{cursor: pointer;}
	.select_p.red{color: #ff5454; font-weight: bold;}
	.select_p.red *{color: #ff5454; font-weight: bold;}
	.obj-form .select_p.red em{color: #ff5454;}
</style>
<assign name="account_value_1" value="1"/>
<assign name="account_value_2" value="2"/>
<assign name="user_jur" value="$Think.session.userinfo.id"/>
<div class="plate_all">
	<if condition="$Thinkphp.session.userinfo.type eq 1">
	<div class="plate_outline" style="margin-top: 0px;">★ 网络资源</div>
	<div class="plate_title">
		<ul>
			<volist name="data" id="v">
				<if condition="$v['plate_type'] eq 1">
					<li class="select_p <in name="v['id']" value="$result.plate_id"> red</in>" plate_type="1" bannerimg="{$v['plate_img']}" vla="{$v['id']}"><a>⊙ {$v['plate_name']}</a></li>
				</if>
			</volist>
		</ul>
	</div>
	</if>

	<in name="account_value_1" value="$accounttype">
	<div class="plate_outline">★ 企业资源</div>
	<div class="plate_title">
		<ul>
			<volist name="data" id="v">
				<if condition="($v['userid'] eq $user_jur) or ($Thinkphp.session.userinfo.type eq 1)">
					<if condition="$v['plate_type'] eq 2">
						<div class="plate_frame">
							<span class="plate_province select_p <in name="v['id']" value="$result.plate_id"> red</in>" plate_type="2" bannerimg="{$v['plate_img']}" vla="{$v['id']}">● {$v['plate_name']}</span>
							<volist name="v['subplate']" id="list1">
								<span class="plate_province select_p <in name="list1['id']" value="$result.plate_id"> red</in>" plate_type="2" bannerimg="{$list1['plate_img']}" vla="{$list1['id']}"><em>⊙ {$list1['plate_name']}</em></span>
								<volist name="list1['subplates']" id="list2">
									<span class="plate_province select_p <in name="lsit2['id']" value="$result.plate_id"> red</in>" plate_type="2" bannerimg="{$list2['plate_img']}" vla="{$list2['id']}"><em class='em10'>⊙ {$list2['plate_name']}</em></span>
									<volist name="list2['subplates']" id="list3">
										<span class="plate_province select_p <in name="list3['id']" value="$result.plate_id"> red</in>" plate_type="2" bannerimg="{$list3['plate_img']}" vla="{$list3['id']}"><em class='em20'>⊙ {$list3['plate_name']}</em></span>
									</volist>
								</volist>
							</volist>
						</div>
					</if>
				</if>
			</volist>
		</ul>
	</div>
	</in>

	<in name="account_value_2" value="$accounttype">
	<div class="plate_outline">★ 政府资源</div>
	<volist name="data" id="v">
		<if condition="$v['plate_type'] eq 3">
			<div class="plate_frame">
				<span class="plate_province select_p <in name="v['id']" value="$result.plate_id"> red</in>" plate_type="3" bannerimg="{$v['plate_img']}" vla="{$v['id']}">● {$v['plate_name']}</span>
				<volist name="v['subplate']" id="list1">
					<span class="plate_province select_p <in name="list1['id']" value="$result.plate_id"> red</in>" plate_type="3" bannerimg="{$list1['plate_img']}" vla="{$list1['id']}"><em>⊙ {$list1['plate_name']}</em></span>
					<volist name="list1['subplates']" id="list2">
						<span class="plate_province select_p <in name="list2['id']" value="$result.plate_id"> red</in>" plate_type="3" bannerimg="{$list2['plate_img']}" vla="{$list2['id']}"><em class='em10'>⊙ {$list2['plate_name']}</em></span>
						<volist name="list2['subplates']" id="list3">
							<span class="plate_province select_p <in name="list3['id']" value="$result.plate_id"> red</in>" plate_type="3" bannerimg="{$list3['plate_img']}" vla="{$list3['id']}"><em class='em20'>⊙ {$list3['plate_name']}</em></span>
						</volist>
					</volist>
				</volist>
			</div>
		</if>
	</volist>
	</in>
</div>
<input type="hidden" name="plate_id" value="{$result.plate_id}">
<script type="text/javascript">
	$(function(){
		$(".select_p").each(function(index, element) {
            var t = $(this);
            var tmp_val = t.attr("vla");
            var tmp_platetype = $(this).attr("plate_type");
            if(tmp_platetype == 2){
            	if(t.is(".red")){
					get_customresoure(tmp_val);
				}
            }
            
			t.click(function(){
				var val = $(this).attr("vla");
				var platetype = $(this).attr("plate_type");
				if(platetype == 3){
					$("#tpl_iframe").contents().find(".zhengfu").show();
					var carousel_inner = $( "#tpl_iframe" ).contents().find(".carousel-inner");
					if($(this).is(".red")){
						carousel_inner.find(".zf_"+val).remove();
					}else{
						var bannerimg = $(this).attr("bannerimg");
						carousel_inner.append("<div class=\"item active zf_"+val+"\"><img src=\""+bannerimg+"\" class=\"slide-image\"/></div>");
					}
				}else if(platetype == 1){
					if(t.is(".red")){
						$( "#tpl_iframe" ).contents().find(".p_"+val).show();
					}else{
						$( "#tpl_iframe" ).contents().find(".p_"+val).hide();
					}
				}else if(platetype == 2){
					if(t.is(".red")){
						remove_info(val);
					}else{
						get_customresoure(val);
					}					
				}
				if(t.is(".red")){
					t.addClass("red");
				}else{
					t.removeClass("red");
				}
				get_plateid();
			})
        });

        //获取选中的版块ID
        function get_plateid(){
        	var plate_id = "";
        	$(".red").each(function(index, element) {
        		var t = $(this);
        		var val = t.attr("vla");
        		plate_id += val+",";
        	});
        	$("input[name='plate_id']").val(plate_id);
        }

        //获取自定义资源内容
        function get_customresoure(val){
        	var url = "/Admin/Index/get_palte_subinfo";
			var data = {
				"plate_id":val,
				random:Math.random()
			};
			$.ajax({
				url:url,
				data:data,
				type:"POST",
				dataType:"JSON",
				success:function (data){
					get_subinfo(data);
				},
			});
        }

        //循环读取内容信息
        function get_subinfo(data){
        	var customplate = $("#tpl_iframe").contents().find(".customplate");
			var str2 = '';
        	var str1 = "<div class=\"plate_construction\" type_id='"+data.id+"' style=\"display:block;\"><div class=\"m10\"><div class=\"plate_title\"><h3>"+data.plate_name+"</h3><a>更多>></a></div><div class=\"p_float p_jxuan\"><ul>";
        	var subinfo = data.subinfo;
			$.each(subinfo, function(i, item) {
				str2 += "<li><a><span class=\"p_img\"><img src="+item.pic+" height=\"90\"></span><span class=\"p_txt\"><h3>"+item.title+"</h3><label>"+item.description+"</label></span></a></li>";
	        });
	        var str3 = "</ul></div></div></div>";
	        var str4 = str1+str2+str3;
	        customplate.append(str4);
        }
        //移除元素
        function remove_info(id){
        	var customplate = $("#tpl_iframe").contents().find(".customplate");
        	customplate.find(".plate_construction").each(function(index, element) {
                var t = $(this);
        		var typeid = t.attr("type_id");
        		if(typeid == id){
        			t.remove();
        		}
            });
        }

	})
</script>


						</span>
					</li>

					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">商城Banner</label></li>
					<li>
						<label class="fl tle">商城标题：</label>
						<span class="fl cnt"><input name="shop_c_title" class="form-control" value="{$result.shop_c_title}" placeholder="商城标题" style="width: 450px;"></span>
					</li>
					<li>
						<label class="fl tle">banner：</label>
						<span class="fl cnt"><input name="shopimg" id="shopimg" value="{$result.shopimg}" class="form-control" placeholder="商城Banner" style="width: 450px;"><a class="browse" f='shopimg'>浏览···</a></span>
					</li>
					<li>
						<label class="fl tle">链接地址：</label>
						<span class="fl cnt"><input name="shoplink" class="form-control" value="{$result.shoplink}" placeholder="链接地址" style="width: 450px;"></span>
					</li>

					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">分享设置</label></li>
					<li>
						<label class="fl tle">分享标题：</label>
						<span class="fl cnt"><input name="sharetitle" class="form-control" value="{$result.sharetitle}" placeholder="分享标题" style="width: 450px;"></span>
					</li>
					<li>
						<label class="fl tle">分享描述：</label>
						<span class="fl cnt"><input name="sharedesc" class="form-control" value="{$result.sharedesc}" placeholder="分享描述" style="width: 450px;"></span>
					</li>
					<li>
						<label class="fl tle">分享图标：</label>
						<span class="fl cnt"><input name="shareico" id="shareico" value="{$result.shareico}" class="form-control" placeholder="分享图标" style="width: 450px;"><a class="browse" f='shareico'>浏览···</a></span>
					</li>

					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">其他参数</label></li>
					<li>
						<label class="fl tle">状态显示：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="state" value="1" <if condition="$result.state eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="state" value="0" <if condition="$result.state eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<li style="display: none;">
						<label class="fl tle">导航显示：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="isbottom" value="1" <if condition="$result.isbottom eq 1">checked="checked"</if>> 下
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="isbottom" value="0" <if condition="$result.isbottom eq 0">checked="checked"</if>> 上
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="isbottom" value="2" <if condition="$result.isbottom eq 2">checked="checked"</if>> 都不显示
						</span>
					</li>
					<li>
						<label class="fl tle">显示访问量：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="showv" value="1" <if condition="$result.showv eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="showv" value="0" <if condition="$result.showv eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<!--<li>-->
						<!--<label class="fl tle">查询次数：</label>-->
						<!--<span class="fl cnt"><input name="num" class="txtlength200" placeholder="查询次数" value="{$result.num}" style="width:100px;"></span>-->
					<!--</li>-->
					<li class="oline" style="width:100%;"><span class="dividerline"></span></li>
					<li><label class="fl tle" style="font-weight: bold; font-size: 16px;">防伪信息</label></li>
					<li>
						<label class="fl tle">是否加防伪：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="ep_fwei" value="1" <if condition="$result.ep_fwei eq 1">checked="checked"</if>> 开启
							&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="ep_fwei" value="0" <if condition="$result.ep_fwei eq 0">checked="checked"</if>> 关闭
						</span>
					</li>
					<div id="fweishow" style="display:none;">
					<li>
						<label class="fl tle">生产厂商：</label>
						<span class="fl cnt"><input name="ep_sc" class="txtlength200" placeholder="生产厂商" value="{$result.ep_sc}"></span>
					</li>
					<li>
						<label class="fl tle">企业地址：</label>
						<span class="fl cnt"><input name="ep_addres" class="txtlength200" placeholder="企业地址" value="{$result.ep_addres}"></span>
					</li>
					<li>
						<label class="fl tle">服务热线：</label>
						<span class="fl cnt"><input name="ep_phone" class="txtlength200" placeholder="服务热线" value="{$result.ep_phone}"></span>
					</li>
					<li>
						<label class="fl tle">邮编：</label>
						<span class="fl cnt"><input name="ep_code" class="txtlength200" placeholder="邮编" value="{$result.ep_code}"></span>
					</li>
					</div>
					<!--针对一物一码的活动时间-->
					<if condition="$isyard eq 1">
					<link rel="stylesheet" type="text/css" href="/assets/live/css/jquery.datetimepicker.css"/>
					<li>
						<label class="fl tle">开始时间：</label>
						<span class="fl cnt"><input id="yard_startdate" name="yard_startdate" class="txtlength200" placeholder="开始时间" value="{$result.yard_startdate}"></span>
					</li>
					<li>
						<label class="fl tle">结束时间：</label>
						<span class="fl cnt"><input id="yard_enddate" name="yard_enddate" class="txtlength200" placeholder="结束时间" value="{$result.yard_enddate}"></span>
					</li>
						<script src="/assets/live/js/jquery.datetimepicker.full.js"></script>
						<script type="text/javascript">
							function getNowFormatDate() {
								var date = new Date();
								var seperator1 = "-";
								var seperator2 = ":";
								var month = date.getMonth() + 1;
								var strDate = date.getDate();
								if (month >= 1 && month <= 9) {
									month = "0" + month;
								}
								if (strDate >= 0 && strDate <= 9) {
									strDate = "0" + strDate;
								}
								var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
										+ " " + date.getHours() + seperator2 + date.getMinutes();
								return currentdate;
							}
							$.datetimepicker.setLocale('zh');
							$('#yard_startdate').datetimepicker({value:<if condition="$result['yard_startdate'] neq ''">'{$result.yard_startdate}'<else />getNowFormatDate()</if>,step:10});
							$('#yard_enddate').datetimepicker({value:<if condition="$result['yard_enddate'] neq ''">'{$result.yard_enddate}'<else />getNowFormatDate()</if>,step:10});
						</script>
					</if>
					<li class="submit">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><input type="submit" value="确定修改" class="submitbtn" /> <a onclick="javascript:history.go(-1);" style="cursor:pointer;">取消</a></span>
					</li>
				</ul>
			</form>
		</div>
		<div class="obj-previewimg">

		</div>
	</div>

</div>

<script type="text/javascript">
	$(function(){
		
		$(".select_p").each(function(index, element) {
            var t = $(this);
			t.click(function(){
				
				var val = $(this).attr("vla");
				var platetype = $(this).attr("plate_type");
				if(platetype == 3){
					$("#tpl_iframe").contents().find(".zhengfu").show();
					var carousel_inner = $( "#tpl_iframe" ).contents().find(".carousel-inner");
					if($(this).is(".red")){
						carousel_inner.find(".zf_"+val).remove();
					}else{
						var bannerimg = $(this).attr("bannerimg");
						carousel_inner.append("<div class=\"item active zf_"+val+"\"><img src=\""+bannerimg+"\" class=\"slide-image\"/></div>");
					}
				}

				if($(this).is(".red")){
					$(this).removeClass("red");
					$( "#tpl_iframe" ).contents().find(".p_"+val).hide();
				}else{
					$(this).addClass("red");
					$( "#tpl_iframe" ).contents().find(".p_"+val).show();
				}
				get_plateid();

			})
			
        });

        //获取选中的版块ID
        function get_plateid(){
        	var plate_id = "";
        	$(".red").each(function(index, element) {
        		var t = $(this);
        		var val = t.attr("vla");
        		plate_id += val+",";
        	});
        	$("input[name='plate_id']").val(plate_id);
        }

	})
	
</script>
</body>
</html>
